package com.onec.service.channel.entity;

import com.onec.service.api.enums.ProductEnum;
import com.onec.service.api.enums.StatusEnum;
import com.onec.service.api.enums.SystemTypeEnum;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 在线订单实体
 * 渠道信息。
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_channel_info")
public class ChannelInfo implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    @Version
    @Column(name = "version", length = 8)
    private Integer version;

    /**
     * 通道编号
     */
    @Column(name = "code", length = 32, unique = true)
    private String code;
    /**
     * 通道名称
     */
    @Column(name = "name", length = 32)
    private String name;

    @Column(name = "product", length = 8)
    @Enumerated(EnumType.STRING)
    private ProductEnum product;

    /**
     * 联系人
     */
    @Column(name = "contacts", length = 32)
    private String contacts;

    @Column(name = "phone", length = 32)
    private String phone;
    /**
     * 机构编号
     */
    @Column(name = "no", length = 32, unique = true)
    private String no;

    /**
     * 通道标识：一个通道可以有多条通道信息：但是通道标识必须为同一个：
     * 便于处理一条通道多个商户信息共同使用的情况
     */
    @Column(name = "channel_flag", length = 32)
    private String channelFlag;
    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "create_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
    /**
     * 变更
     */
    @LastModifiedDate
    @Column(name = "update_time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;
    /**
     * 创建者
     */
    @Column(name = "creator", length = 32)
    private String creator;
    /**
     * 产品备注
     */
    @Column(name = "remarks")
    private String remarks;
    /**
     * 通道状态
     */
    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private StatusEnum status;
    /**
     * 配置文件存放位置
     * <p>
     * SQL
     * properties
     */
    @Column(name = "config")
    @Enumerated(EnumType.STRING)
    private SystemTypeEnum config;


}
